package com.gr.experimental.model.impl;

import com.gr.experimental.model.UID;

public class UIDImpl implements UID {
	private String value;

	public UIDImpl(String value) {
		this.value = value; 
	} 

	public UIDImpl(long value) {
		this.value = "" + value; 
	} 

	/**
	 * {@inheritDoc}
	 * @see com.gr.experimental.model.UID#getValue()
	 */
	public String getValue() {
		return this.value;
	}

	/**
	 * {@inheritDoc}
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((this.value == null) ? 0 : this.value.hashCode());
		return result;
	}

	/**
	 * {@inheritDoc}
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final UIDImpl other = (UIDImpl) obj;
		if (this.value == null) {
			if (other.value != null)
				return false;
		} else if (!this.value.equals(other.value))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "UID:" + value ;
	}

}
